// LemCoop
// Copyright (C) 2013  Oliver Naumann <bldrax@gmail.com>

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

#ifndef LEMC_ALLEGRO_BITMAP_MANAGER_H
#define LEMC_ALLEGRO_BITMAP_MANAGER_H

#include "WindowsIncludes.h"
#include <allegro5/allegro.h>
#include <allegro5/allegro_image.h>

#include "resource_manager.h"

/*
* Resource manager for allegro_bitmaps
*/
class AllegroBitmapManager : public ResourceManager <ALLEGRO_BITMAP*>
{
private:
	/*
	* Loads an allegro_bitmap into the resource list.
	*
	* @param resource_id The identifier of the resource.
	* 
	* @return True if the resource was loaded successfully, false else.
	*/
	bool LoadResource(std::string resource_id);

	/*
	* Destroys an allegro_bitmap.
	*
	* @param resource The resource to be destroyed.
	* 
	* @return True if the resource was destroyed successfully, false else.
	*/
	bool DestroyResource(ALLEGRO_BITMAP* resource);

public:
	/*
	* The constructor merely passes on the path to the resource file to the template classes constructor.
	*
	* @param resource_file_path The path to the resource file.
	*/
	AllegroBitmapManager(std::string resource_file_path);
};

static AllegroBitmapManager allegro_bitmap_resource_manager("resources.txt");

#endif